package com.softeem.service.Impl;

import com.softeem.entity.User;
import com.softeem.mapper.UserMapper;
import com.softeem.mapper.UserMapper;
import com.softeem.model.UserModel;
import com.softeem.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Can丶
 * @create 2021-04-29 17:26
 */
import java.util.List;
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;
    @Override
    public User login(User user) {
        User realUser = userMapper.selectByUser(user);
        if (realUser!=null&&user.getUPassword().equals(realUser.getUPassword())){
            return realUser;
        }
        return null;
    }

    @Override
    public Boolean register(User user) {
        return userMapper.insertSelective(user)>0;
    }


    public List<UserModel> getUsers() {
        return userMapper.getUsers();
    }
}
